﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace HMI.Header
{
    /// <summary>
    /// HeaderTool.xaml 的交互逻辑
    /// </summary>
    public partial class HeaderTool : UserControl
    {
        public HeaderTool()
        {
            InitializeComponent();
        }
        public string TitleTxt
        {
            get { return Convert.ToString(titlex.Content); }
            set
            {
                titlex.Content = value;
            }
        }
        public static readonly RoutedEvent CloseEvent = EventManager.RegisterRoutedEvent("CloseFrm", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(HeaderTool));
        public event RoutedEventHandler CloseFrm
        {
            add { this.AddHandler(CloseEvent, value); }
            remove { this.RemoveHandler(CloseEvent, value); }
        }
        public void OnClosed(RoutedEventArgs e)
        {
            this.RaiseEvent(e);
        }
        private void closex_Click(object sender, RoutedEventArgs e)
        {
            RoutedEventArgs args = new RoutedEventArgs(CloseEvent);
            this.OnClosed(args);
        }

        public static readonly RoutedEvent MinEvent = EventManager.RegisterRoutedEvent("MinFrm", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(HeaderTool));
        public event RoutedEventHandler MinFrm
        {
            add { this.AddHandler(MinEvent, value); }
            remove { this.RemoveHandler(MinEvent, value); }
        }
        public void OnMin(RoutedEventArgs e)
        {
            this.RaiseEvent(e);
        }
        private void minx_Click(object sender, RoutedEventArgs e)
        {
            RoutedEventArgs args = new RoutedEventArgs(MinEvent);
            this.OnMin(args);
        }

        public string TitleName
        {
            get { return titlex.Content.ToString(); }
            set { titlex.Content = value; }
        }
    }
}
